package Testdmo4;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:周次煜
 * Date: 2024-03-30
 * Time：22:10
 */
public class J3_30 {

    public static void main(String[] args)
    {

        task1();
        task2();
        task3();

    }

    public static void task1()
    {
        //输入两个整数给a,b，交换后输出//
        Scanner sc=new Scanner(System.in);
        System.out.println("请输入a的值:");
        int a=sc.nextInt();
        System.out.println("请输入b的值:");
        int b=sc.nextInt();
        int tmp=a;
        a=b;
        b=tmp;
        System.out.println("a="+a+"\tb="+b);

    }

    public static void task2()
    {
        //从键盘读入一个三位整数，将百位、十位分离后显示。如:输入:153，显示1，5，3//
        Scanner s=new Scanner(System.in);
        System.out.println("请输入一个三位数:");
        int i=s.nextInt();
        int a=i/100;
        int b=i/10%10;
        int c=i%10;
        System.out.println("百位:"+a+"\n 十位:"+b+"\n 个位:"+c);

    }

    public static void task3()
    {
        //读入三角形的三边长，显示其面积//
        Scanner sc=new Scanner(System.in);
        System.out.print("请输入三角形三边:");
        double a=sc.nextDouble();
        double b=sc.nextDouble();
        double c =sc.nextDouble();
        double p =(a+b+c)/2;
        double s=Math.sqrt(p*(p-a)*(p-b)*(p-c));//三角形面积公式//
        System.out.println(s);
        sc.close();
    }



}









